﻿using UnityEngine;
using System.Collections;

public class SightRange : MonoBehaviour {

    [HideInInspector] public GameObject m_ObjTarget = null;
    public string m_strEnemyFaction = "Enemy";

    void OnTriggerEnter2D(Collider2D CollObj)
    {
        if (CollObj.gameObject.tag == m_strEnemyFaction)
        {
            m_ObjTarget = CollObj.gameObject;
        }
    }

    void OnTriggerExit2D(Collider2D CollObj)
    {
        if (m_ObjTarget != null)
        {
            if (CollObj.gameObject == m_ObjTarget)
            {
                m_ObjTarget = null;
            }
        }
    }
}
